<template>
  <div class="project">
    <el-form
      :model="basicForm"
      label-position="top"
      :rules="basicRules"
      ref="basicFormRef"
    >
      <!-- 基本信息 -->
      <div class="project-part">
        <div class="project-part-title project-part-title1">
          基本信息
        </div>
        <div class="project-part-content">
          <el-row :gutter="24">
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="工程名称"
                prop="projectName"
              >
                <el-input
                  v-model="basicForm.projectName"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="标段名称"
                prop="sectionName"
              >
                <el-input
                  v-model="basicForm.sectionName"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="建设单位"
                prop="buildUnit"
              >
                <el-input
                  v-model="basicForm.buildUnit"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="监理单位"
                prop="watchUnit"
              >
                <el-input
                  v-model="basicForm.watchUnit"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="施工单位"
                prop="workUnit"
              >
                <el-input
                  v-model="basicForm.workUnit"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="检测时间"
                prop="checkTime"
              >
                <el-date-picker
                  v-model="basicForm.checkTime"
                  type="date"
                  placeholder=""
                  value-format="yyyy-MM-dd HH:mm:ss"
                  :disabled="type !== 'edit'"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item label="工程地址" prop="address">
                <el-input
                  v-model="basicForm.address"
                  :disabled="type !== 'edit'"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item label="工程类型" prop="type">
                <el-input
                  v-model="basicForm.type"
                  :disabled="type !== 'edit'"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="工程规模"
                prop="workSize"
              >
                <el-input
                  v-model="basicForm.workSize"
                  :disabled="type !== 'edit'"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="危险性较大的分部分项工程或超一定规模的危险性较大分部分项工程"
                prop="scale"
              >
                <el-input
                  v-model="basicForm.scale"
                  :disabled="type !== 'edit'"
                  type="textarea"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :sm="24" :md="12" :lg="8" :xl="6">
              <el-form-item
                label="施工进展情况"
                prop="progress"
              >
                <el-input
                  v-model="basicForm.progress"
                  :disabled="type !== 'edit'"
                  type="textarea"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-form>
  </div>
</template>
<script>
export default {
  props: {
    type: String,
    detailInfo: Object
  },
  components: {},
  data() {
    return {
      basicForm: {
        address: '',
        buildUnit: '',
        checkTime: '',
        pkid: '',
        progress: '',
        projectId: '',
        projectName: '',
        scale: '',
        sectionName: '',
        status: '',
        type: '',
        watchUnit: '',
        workSize: '',
        workUnit: ''
      },
      basicRules: {
        checkTime: [
          {
            required: true,
            message: '请选择检测时间',
            trigger: 'blur'
          }
        ],
        address: [
          {
            required: true,
            message: '请填写工程地址',
            trigger: 'blur'
          }
        ]
      }
    }
  },
  computed: {
    titles() {
      return [this.title]
    }
  },
  mounted() {},
  watch: {
    detailInfo: {
      handler(val) {
        if (val.pkid || val.projectId) {
          this.basicForm = Object.assign(
            this.basicForm,
            this.detailInfo
          )
        }
      },
      immediate: true,
      deep: true
    }
  },
  methods: {}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/css/form.scss';
</style>
